#ifndef CAMERAMANAGER_H
#define CAMERAMANAGER_H

#include <QObject>
#include <QThread>

#include "ImageProcessor.h"
#include "DataSender.h"
#include "myini.h"
#include "airmidwvudp.h"
#include "groundwvudp.h"
#include "airvisibleudp.h"

class CameraManager : public QObject
{
    Q_OBJECT
public:
    explicit CameraManager(CAMERA cameras, QObject *parent = nullptr);

    ~CameraManager();

    void startEncode();  //开始编码并发送

    void stopEncode();   //停止编码并发送

    void init();    //初始化接收、处理、发送

    void connectObj();   //连接必要的信号和槽
signals:
    void sigErrorOccurred(const QString &errorString);

     void sigToShowUi(CAMERA camera, int width, int height, int fps); //在ui上显示

private:
    CAMERA m_camera;                        //图像类型

    UdpBase *m_udpRec;                      //接收和组片

    ImageProcessor *m_process;              //压缩

    DataSender *m_sender;                   //发送

    QThread *m_recThread;

    QThread *m_encodeThread;

    QThread *m_sendThread;

    QVector<QThread*> m_threads;
};

#endif // CAMERAMANAGER_H
